<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="css/mui.min.css" />
		<link rel="stylesheet" href="css/tixian.css" />
        <script src="js/jquery-3.3.1.min.js"></script>
         <script src="js/config.js"></script>
		<title>提现</title>
	</head>
	<body>
		<!--<header class="mui-bar mui-bar-nav">-->
			<!--<h3 class="mui-title">大钞市·提现</h3>-->
		<!--</header>-->
		
		<div class="top">
			<!--<a href="./index.html" class="back mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>-->

			<div>
					<h4>我的余额</h4>
				</div>
				

				
		</div>
		
		<div class="content">
			
			<div class="box">
				<p class="item1">当前余额 (元)</p>
				<p class="item2">0.00</p>
				<div class="item3">立即提现</div>
				
			</div>
			
			
			
			<div class="box1">
				
				<div class="item4">
					暂无明细
				</div>
				
				<div class="item5">
					<div class="item5C">
						<div class="day">2019-03</div>
						<div class="listf">
							<!--<div class="list">
							<div class="left">
								<div class="img">
									<img class="imgIcon" src="./images/2.jpg" alt="" />
								</div>
								
								<div class="desc">
									<div class="name">
										塑料卡老地方
									</div>
									
									<div class="time">
										2019-03-22 18:16:34
									</div>
								</div>
							</div>
							
							<div class="right">
								<div class="money">2.3元</div>
							</div>
						</div>-->
						</div>
						
					</div>
					
					
				</div>
				
			</div>
			
			
			
		</div>
			<script>

                //获取当前日期

                var myDate = new Date();
                myDate.getYear();        //获取当前年份(2位)
                myDate.getFullYear();    //获取完整的年份(4位,1970-????)
                var month = myDate.getMonth()+1;       //获取当前月份(0-11,0代表1月)
                if (month < 10){
                    month = "0"+month;
                }
                var html = myDate.getFullYear()+"-"+ month;
                $(".day").eq(0).html(html)
				
				//获取零钱
			$.ajax({
						url:host+"/buss/user/info",
						type:"get",
						success:function(res){
							console.log(JSON.stringify(res));
							$(".item2").eq(0).html(res.data.account);
						},
						error:function(){
							console.log("error")
						}
				
				
			})
			
			$(".item3").eq(0).click(function(){
				window.location.href="tixianway.html"
			})
			
			
			//获取余额明细
			
			$.ajax({
				url:host+"/buss/account/log/list",
				type:"get",
				success:function(res){
					
					console.log(JSON.stringify(res))
					console.log(res.data.length)
					var leng = res.data.length;
					var str = '';
					var img=null;
					for(let i = 0;i < leng;i++){
							var timeText = res.data[i].createDate;

							var money = res.data[i].price;
                       		 var tips = res.data[i].remarks;
							var taskName = res.data[i].taskName;
							if(taskName !== null){
                                taskName = res.data[i].taskName;
							}else{
                                taskName = "";
							}
							if(res.data[i].imgIcon){
								 img = res.data[i].imgIcon
							}else{
								img="./images/2.jpg";
							}
						
						str+='<div class="list"><div class="left">'+
								'<div class="img">'+
									'<img class="imgIcon" src='+img+' alt="" />'+
								'</div>'+
								'<div class="desc">'+
									'<div class="name">'+tips+
									'</div>'+
									'<div class="time">'+timeText+	
									'</div>'+
									'<div class="taskName">'+taskName+
									'</div>'+
								'</div>'+
							'</div>'+
							'<div class="right">'+
								'<div class="money">'+money +'元'+'</div>'+
							'</div></div>'
						
						}
					
					$(".listf").html(str);
					
					if(res.success){
						$(".item4").eq(0).css({display:'none'});
						$(".item5").eq(0).css({display:'block'});
					}else{
						$(".item5").eq(0).css({display:'none'});
						$(".item4").eq(0).css({display:'block'});
					}
					
				},
				error:function(){
						console.log("获取余额明细失败")
					}
			})
				
				
			</script>
			
	
	</body>
</html>
